SlideToRestore

fun SlideToRestore(modifier: Modifier = Modifier, onRestoreStateChanged: (RestoreState) -> Unit = {}, colors: SlideToUnlockColors = DefaultSlideToUnlockColors(), hintTexts: HintTexts = HintTexts.defaultHintTexts().copy(defaultText = "Slide to restore"), trackShape: Shape = RoundedCornerShape(percent = 50), thumbSize: DpSize = DpSize(ThumbSize, ThumbSize), fractionalThreshold: Float = 0.85f, paddings: PaddingValues = PaddingValues(SlideToUnlockDefaults.Paddings), hintPaddings: PaddingValues = PaddingValues(start = thumbSize.width, end = thumbSize.width), onSlideFractionChanged: (Float) -> Unit = {}, onSlideCompleted: () -> Unit = {}, orientation: SlideOrientation = SlideOrientation.Horizontal, thumb: @Composable BoxScope.(isSlided: Boolean, slideFraction: Float, colors: SlideToUnlockColors, size: DpSize, orientation: SlideOrientation) -> Unit = { slided, _, _, size, orient -> SlideToUnlockDefaults.Thumb( modifier = Modifier.size(thumbSize), isSlided = slided, colors = colors, thumbSize = thumbSize, orientation = orient, ) }, hint: @Composable BoxScope.(isSlided: Boolean, slideFraction: Float, hintTexts: HintTexts, colors: SlideToUnlockColors, paddings: PaddingValues, orientation: SlideOrientation) -> Unit = { slided, fraction, _, _, paddings, orient -> SlideToUnlockDefaults.Hint( modifier = Modifier.align(Alignment.Center), slideFraction = fraction, hintTexts = hintTexts, isSlided = slided, colors = colors, paddingValues = hintPaddings, orientation = orient, ) })

A composable that provides a slide-to-restore functionality.

This component is built on top of the SlideToUnlock composable and handles the logic for restoring purchases using the RevenueCat SDK. It manages the different states of the restore process (loading, success, error) and communicates them through the onRestoreStateChanged callback.

Parameters

modifier

The modifier to be applied to the component.

onRestoreStateChanged

A callback that is invoked when the restore state changes. It provides the current RestoreState.

colors

The colors to be used for the component. Defaults to DefaultSlideToUnlockColors.

hintTexts

The texts to be displayed as hints. Defaults to a restore-specific hint.

trackShape

Defines the shape of the background track. Defaults to a rounded rectangle.

thumbSize

The size of the draggable thumb.

fractionalThreshold

The fraction of the track (from 0.0f to 1.0f) that the user must slide the thumb past to trigger the restore process. Defaults to 0.85f (85%).

paddings

The external padding values to be applied to the entire component.

hintPaddings

The internal padding values for the hint composable.

onSlideFractionChanged

Optional callback invoked with the current slide progress fraction (0f–1f).

onSlideCompleted

A callback that is invoked when the slide gesture is completed, just before the restore process begins.

orientation

The direction of the sliding gesture. Defaults to SlideOrientation.Horizontal.

thumb

A composable slot for customizing the draggable thumb. It provides the slide state, current slide fraction, colors, size, and orientation.

hint

A composable slot for customizing the hint text or visuals inside the track. It provides the slide state, current slide fraction, hint texts, colors, paddings, and orientation.